#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{

	int n,k;
	scanf("%d %d",&n,&k);
	int a[n+1];
	int cnt = 0;
	for(int i = 1;i<=n;i++) scanf("%d",&a[i]);
	for(int i = 1;i<=n;i++)
		if(a[i]>0&&a[i]>=a[k]) cnt++;
	printf("%d\n",cnt);
}
